PUBLIC = ../../public
SRC = src
BIN = bin/debug
GLOBAL_BIN = ../../bin
CFLAGS = -Wall -pedantic -ansi -Werror -D_GNU_SOURCE
CC = gcc
LIB_TOOL = ar
LIB_FLAGS = -r -s
COMPILE_FLAG = -c

all: release 

debug: CFLAGS+=-g 
debug: BIN=bin/debug
debug: GLOBAL_BIN=../../bin/debug
debug: $(BIN)/SocketServer  $(BIN)/SocketClient clean
	@echo "**********************************************************"
	@echo "*							*"
	@echo "*		SUCCEFULY FINISHED			*"
	@echo "*							*"
	@echo "**********************************************************"


release: CFLAGS+=-DNDEBUG
release: BIN=bin/release
release: GLOBAL_BIN=../../bin/release
release: $(BIN)/SocketServer $(BIN)/SocketClient clean
	@echo "**********************************************************"
	@echo "*							*"
	@echo "*		SUCCEFULY FINISHED			*"
	@echo "*							*"
	@echo "**********************************************************"

$(BIN)/SocketServer: SocketServer.o
	$(CC) $(CFLAGS) SocketServer.o -o $(BIN)/SocketServer

$(BIN)/SocketClient: SocketClient.o
	$(CC) $(CFLAGS) SocketClient.o -o $(BIN)/SocketClient



SocketServer.o: SocketServer.c
	$(CC) $(COMPILE_FLAG) $(CFLAGS) -I$(PUBLIC) SocketServer.c -o SocketServer.o

SocketClient.o: SocketClient.c
	$(CC) $(COMPILE_FLAG) $(CFLAGS) -I$(PUBLIC) SocketClient.c -o SocketClient.o


Exec:
	touch $(BIN)Test.scr;\
	echo "#!/bin/bash" > Test.scr; \
	echo ./$(BIN)/SocketServer Yehuda Roth\&\ >>Test.scr; \
	echo ./$(BIN)/SocketClient\&\ >>Test.scr; \


clean: 
	rm *.o
